package cn.tedu.controller;/**
 * @Author 金帮嘉诚 @Date 2021-07-13 星期二 16:50
 */
/*本类用于测试*/

import org.springframework.web.bind.annotation.*;

/**
 * 知识点
 *
 * @RestController
 * @RequestMapping()
 */
@RestController
@RequestMapping("/car/")
public class CarController {
    @RequestMapping("get")
    public String get() {
        return "getCar";
    }

//    @RequestMapping("getCar")
//    public Car getCar() {
//        Car car = new Car();
//        car.setId(111);
//        car.setUser("JBJC");
//        car.setType("Mix");
//        car.setColor("Red");
//        car.setPrice(10000);
//        return car;
//    }

    @RequestMapping("add")
    public void add(int id) {
        System.out.println("数据添加成功,id=" + id);
    }


    @RequestMapping("save")
    public String save(int id, String user) {
        String s = "数据保存成功，id=" + id + ",user=" + user;
        System.out.println(s);
        return s;
    }

    @RequestMapping("obj")
    public void obj(Car c) {
        System.out.println(c);
    }

    @RequestMapping("insert/{x}/{y}/{age}")
    public void insert(@PathVariable int x, @PathVariable String y, @PathVariable int age) {
        System.out.println("数据插入成功！id=" + x + ",user=" + y + ",age=" + age);
    }

}
